<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="/static/css/font.css">
        <link rel="stylesheet" href="/static/css/xadmin.css">
        <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/static/js/xadmin.js"></script>
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="demoTable">
                            <div class="layui-inline">
                                <select class="layui-select" id="type">
                                    <option value="">入库类型</option>
                                    <option value="其他入库">其他入库</option>
                                    <option  value="采购入库">采购入库</option>
                                    <option value="调拨入库">调拨入库</option>
                                    <option value="盘盈入库">盘盈入库</option>
                                    <option value="退货入库">退货入库</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <select class="layui-select" id="status">
                                    <option value="">审核状态</option>
                                    <option value="审核通过">审核通过</option>
                                    <option  value="审核失败">审核失败</option>
                                    <option value="待审核">待审核</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <input class="layui-input" placeholder="入库单号" name="id" id="demoReload" autocomplete="off">
                            </div>
                            <button class="layui-btn" data-type="reload">搜索</button>
                        </div>
                        <div class="layui-card-header">
                            <button class="layui-btn layui-btn-danger" ><i class="layui-icon"></i><a href="{:url('export')}">导出</a></button>
                            <button class="layui-btn" onclick="xadmin.open('添加用户','./member-add.html',600,400)"><i class="layui-icon"></i>添加</button>
                        </div>
                        <div class="layui-card-body layui-table-body layui-table-main">
                            <table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>
                        </div>

                    </div>
                </div>
            </div>
        </div> 
    </body>
    <script>
        layui.use('table', function(){
            var table = layui.table;

            //方法级渲染
            table.render({
                elem: '#LAY_table_user'
                ,url: '/admin/order/orders'
                ,cols: [[
                    {checkbox: true, fixed: true}
                    ,{field:'order_no', title: '入库单号', width:80}
                    ,{field:'shop', title: '入库门店', width:80, sort: true}
                    ,{field:'type', title: '入库类型', width:80}
                    ,{field:'count', title: '入库数量'}
                    ,{field:'do_people', title: '经办人员', sort: true, width:80}
                    ,{field:'make_people', title: '制单人员', sort: true, width:80}
                    ,{field:'make_time', title: '制单日期', width:80}
                    ,{field:'status', title: '审核状态', sort: true, width:135}
                ]]
                ,id: 'testReload'
                ,page: true
                ,limit:3
                ,height: 310
            });

            var $ = layui.$, active = {
                reload: function(){
                    var demoReload = $('#demoReload');
                    var status = $('#status');
                    var type = $('#type');
                    //执行重载
                    table.reload('testReload', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }
                        ,where: {
                                order_no: demoReload.val(),
                                status:status.val(),
                                type:type.val()
                        }
                    });
                }
            };

            $('.demoTable .layui-btn').on('click', function(){
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
    </script>
</html>